<?php
mysql_connect('localhost', root, kaurkaur);
mysql_select_db('ccramp');
$pdfQuery = mysql_query("SELECT * FROM `album` ORDER BY `slot` DESC LIMIT 20");

include ('../includes/class.ezpdf.php');
$pdf =& new Cezpdf();
$pdf->selectFont('../includes/fonts/Helvetica.afm');

$pdf->ezColumnsStart();
while ($pdfResult = mysql_fetch_array($pdfQuery)) {
$data = array(
array(
'main' => ($pdfResult['artist'] . '  <i>' . $pdfResult['title'] . '</i>'), 
'slotno' => ($pdfResult['slot'])
)
);
$pdf->ezTable($data, array('main'=>'main','slotno'=>'slotno'), '', 
   array('showHeadings'=>0, 'shaded'=>0, 'width'=>260, 'cols' => 
	  array('main'=>
		 array('width'=>230,'justification'=>'left')
	  ), 
	  array('slotno'=> 
		 array('width'=>30,'justification'=>'right')
	  ) 
   )
);

$description = array(
array($pdfResult['review'])
);
$pdf->ezTable($description,'','',array('width'=>260, 'justification'=>'right','showHeadings'=>0));

$GoodCuts = 'Good Cuts: ';
$CutsQuery = mysql_query("SELECT * FROM `track` WHERE (`cddbid`='".$pdfResult['cddbid']."') AND (`virtue`>'2') ");
while($pdfTrackResult = mysql_fetch_array($CutsQuery)) {
   if ($pdfTrackResult[virtue] >= 4) $GoodCuts = $GoodCuts . '<b>';
   if ($pdfTrackResult[virtue] >= 5) $GoodCuts = $GoodCuts . '<u>';
	  $GoodCuts = $GoodCuts . $pdfTrackResult[trackno];
   if ($pdfTrackResult[virtue] >= 5) $GoodCuts = $GoodCuts . '</u>';
   if ($pdfTrackResult[virtue] >= 4) $GoodCuts = $GoodCuts . '</b>';
	  $GoodCuts = $GoodCuts . ' ';
}
$GoodCuts = array(array($GoodCuts)); 
$pdf->ezTable($GoodCuts,'','',array('width'=>260, 'justification'=>'left','showHeadings'=>0));

$AvoidCuts = 'Avoid: ';
$CutsQuery = mysql_query("SELECT * FROM `track` WHERE (`cddbid`='".$pdfResult['cddbid']."') AND (`virtue`<'2') ");
while($pdfTrackResult = mysql_fetch_array($CutsQuery)) {
	  $AvoidCuts = $AvoidCuts . $pdfTrackResult[trackno] . ' ';
}
if ($AvoidCuts === 'Avoid: ') $AvoidCuts = 'Avoid: none (all clean)';
$AvoidCuts = array(array($AvoidCuts)); 
$pdf->ezTable($AvoidCuts,'','',array('width'=>260, 'justification'=>'left','showHeadings'=>0));
$pdf->ezText(' ');
}


//$pdf->ezColumnsStop();
//$pdf->ezColumnsStart();

//$pdf->ezColumnsStop();
$pdf->ezStream();
?>